Currently, a growing quantity of electronic apparatuses do not have a capability of directly connecting to a network, but can connect to other apparatuses by using connectivity apparatuses of the electronic apparatuses, and then connect to the network. The connectivity apparatuses may be WiFi, Bluetooth (BT), and the like.
A client apparatus may be a wearable device, or an electronic apparatus such as a mobile phone, a tablet computer, or a notebook computer. Many wearable devices do not have a capability of directly connecting to a network. Therefore, the wearable devices may connect to a paired electronic apparatus by using Bluetooth, and then exchange messages by using Bluetooth. The electronic apparatus may be referred to as a host apparatus.
Currently, a heartbeat packet technology is widely applied between a client and a server, to discover network exceptions, and may apply to multiple occasions. A principle of the heartbeat packet technology is: a client periodically sends a heartbeat detection packet to a server on the Internet at a fixed time interval; the client determines whether a heartbeat response packet returned by the server is received within preset duration; if the heartbeat response packet returned by the server is not received within the preset duration, the client considers that a network connection to the server has deteriorated (for example, timeout, interruption, or congestion), the server is not suitable for providing network services any longer, and then the client attempts to restore the connection by using a method for re-connecting to or re-selecting the server.
When the wearable devices need to perform heartbeat packet processing, the wearable devices may first notify a mobile phone by using Bluetooth. The mobile phone connects to a network to perform heartbeat packet processing. After obtaining a response, the mobile phone notifies the wearable devices by using Bluetooth.
For electronic apparatuses such as a mobile phone, a tablet computer, and a notebook computer, when an electronic apparatus has a network access capability and a hotspot is enabled, the electronic apparatus is equivalent to a host apparatus, and other electronic apparatuses may connect to the host apparatus by using WiFi, and then connect to a network by using the host apparatus.
Therefore, when one heartbeat packet event is generated in each apparatus, the heartbeat packet event must be initiated by a client apparatus, and then a host apparatus processes each heartbeat packet. Power consumption of the client and the host is relatively large.